package com.hp.bon.sgw.wh.mml.repositories;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

import com.hp.bon.sgw.wh.mml.common.MMLSessionEntity;

public class VCMsgRepository {

	public static Queue<MMLSessionEntity> xmlMsgQueue = new ConcurrentLinkedQueue<MMLSessionEntity>();
	
	public static Queue<MMLSessionEntity> vcMsgQueue = new ConcurrentLinkedQueue<MMLSessionEntity>();
	
	public static Queue<MMLSessionEntity> logoutMsgQueue = new ConcurrentLinkedQueue<MMLSessionEntity>();
	
	public static Queue<String> vcHeartBeatQueue = new ConcurrentLinkedQueue<String>();
	
	public static void offerXmlMsg(MMLSessionEntity entity){
		xmlMsgQueue.offer(entity);
	}	
	public static MMLSessionEntity pollXmlMsg(){
		return xmlMsgQueue.poll();
	}
	
	public static void offerVCMsg(MMLSessionEntity entity){
		vcMsgQueue.offer(entity);
	}
	public static MMLSessionEntity pollVCMsg(){
		return vcMsgQueue.poll();
	}
	
	public static void offerLogoutMsg(MMLSessionEntity entity){
		logoutMsgQueue.offer(entity);
	}
	public static MMLSessionEntity pollLogoutMsg(){
		return logoutMsgQueue.poll();
	}
	
	public static void offerVCHeartBeatMsg(String hbMsg){
		int size = vcHeartBeatQueue.size();
		for(int index=0;index<size-60;index++){
			vcHeartBeatQueue.peek();
		}
		vcHeartBeatQueue.offer(hbMsg.trim());
	}
	public static String pollVCHeartBeatMsg(){
		return vcHeartBeatQueue.poll();
	}
}
